package com.red.star.wechat.data.mappers;


import com.red.star.wechat.data.core.base.MyMapper;
import com.red.star.wechat.data.entity.Fans;
import com.red.star.wechat.data.entity.Mall;
import com.red.star.wechat.data.entity.MallCity;
import com.red.star.wechat.data.entity.MallExpand;
import com.red.star.wechat.data.entity.po.MallCodePO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: Yenan
 * @Description:
 * @Date: Created in 18:19 2018/1/31
 */
public interface MallMapper extends MyMapper<Mall> {

    void updateByMallCode(Mall mall);

    void updateById(Mall mall);

    List<Mall> findAllBRegionCodeAndBRegionName();

    List<Mall> findAllSRegionCodeAndSRegionName();

    public Mall getMallByMallCode(String mallCode);

    public List<Mall> findMallList();

    public List<Mall> findMallListByMallCode(@Param("mallCode") String mallCode);

    public List<Mall> findMalls(@Param("mallCode") String mallCode);

    public List<Mall> findMallAndOms(@Param("mallCode") String mallCode);

    public List<Mall> findMalls();

    public List<Mall> findBRegionName(@Param("mallCode") String mallCode);


    public List<Mall> findSRegionName(@Param("mallCode") String mallCode);

    List<Mall> findMallsByParam(String mallCode);

    List<Mall> listMall(Mall mall);

    List<Mall> findAllMallName();

    List<Mall> findAllSmArea(@Param("bRegionCode") String bRegionCode);

    List<Mall> findAllMallNameArea(@Param("sRegionCode") String sRegionCode);

    Mall findMallByFansAndStoredCard(Fans fans);

    @Select(value = "select DISTINCT t.city from t_mall t where t.city is not null")
    public List<String> findCityName();

    public MallExpand findWelcomeById(@Param("id") Integer id);

    public List<Mall> findBRegionByMallCode(@Param("mallCode") String mallCode);

    public List<Mall> findSRegionByMallCode(@Param("mallCode") String mallCode);

    public List<Mall> findMallsByMallCode(@Param("mallCode") String mallCode);

    public List<String> findCityNameByMallCode(@Param("mallCode") String mallCode);

    public List<Mall> findBRegionCodeAndBRegionName();

    public List<Mall> findBigArea(@Param("mallCode") String mallCode);

    @Select(value = "select * from t_mall where oms_code=#{omsCode}")
    Mall findMallByOmsCode(@Param("omsCode") String omsCode);

    Mall findMallByFansAndStoredCardOther(Fans fans);

    @Select(value = "select * from t_mall where mall_code = #{mallCode}")
    Mall findMallByMallCode(@Param("mallCode") String mallCode);

    List<Mall> findProvinceList();

    List<Mall> findCityList();

    List<Mall> findCountryList();

    @Select(value = "select * from t_mall where mall_name = #{mallName}")
    Mall findMallByMallName(@Param("mallName") String mallName);

    /**
     * 通过mallCode查询omsCode
     *
     * @param mallCode
     * @return
     */
    @Select("select t.oms_code from t_mall t where t.mall_code = #{mallCode}")
    String findOmsCodeByMallCode(@Param("mallCode") String mallCode);

    List<Mall> findAllCity(String province);

    List<Mall> findAllCountry(String city);

    List<Mall> findMallNameList();

    public Mall getMallCodeByMallName(@Param("mallName") String mallName);


    public List<Mall> findAllProvince();

    public List<Mall> findAllCitys();

    public List<Mall> findAllCountrys();

    public List<Mall> findAllCityByProvince(@Param("province") String province);

    public List<Mall> findAllCountryByCity(@Param("city") String city);

    public List<Mall> findMallByWhite();

    List<MallCity> findCityContaiMall();

    /**
     * 通过mallCode查询大、中、小区编号及城市编码
     * @param mallCode
     * @return
     */
    @Select("select t.b_region_code,t.m_region_code,t.s_region_code,t.mall_code,t.city_code from t_mall t where t.mall_code = #{mallCode}")
    public MallCodePO findSomeCodeByMallCode(@Param("mallCode") String mallCode);

    /**
     * 通过大中小区及城市查询商场名称
     * @param typeList
     * @param typeValueArray
     * @return
     */
    List<String> findMallByCode(@Param("typeList") List<String> typeList,
                                @Param("typeValueArray") String[] typeValueArray);

    List<Mall> findAllMallList();
}
